package com.example.shopingcenter.Fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.example.shopingcenter.R;


public class FondFragment extends Fragment {


    private ProgressBar progressBar;
    private TextView texload;

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
     View view=inflater.inflate(R.layout.fragment_fond, container, false);

        progressBar = view.findViewById(R.id.progressBar);
        texload=view.findViewById(R.id.texload);

        // 模拟一个加载任务
        showLoading();
        new android.os.Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                hideLoading();
            }
        }, 3000); // 3秒后隐藏加载动画

        return view;
    }

    private void showLoading() {
        progressBar.setVisibility(View.VISIBLE);
    }

    private void hideLoading() {
        progressBar.setVisibility(View.GONE);
        texload.setVisibility(View.GONE);
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.v("life","fond--onResume");
    }
}


